import COS from 'cos-nodejs-sdk-v5'
// 创建实例
import config from 'config'
let cos = new COS({
  // AppId: config.cos.APPID,
  SecretId: config.get('cos.SecretId'),
  SecretKey: config.get('cos.SecretKey'),
});

let putObject = (params) => {
  return new Promise((resolve, reject)=>{
    cos.putObject(params,(err, data)=>{
      if(err){
        reject(err)
      }else{
        resolve(data)
      }
    })
  })
}
let headObject = (params)=>{
  return new Promise((resolve, reject)=>{
    cos.headObject(params, function(err, data) {
      if(err) {
        reject(err)
      } else {
        resolve(data)
      }
  });
  })
}

export default {
  putObject,
  headObject
}